import React from 'react';
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
} from '@/components/ui/dialog';
import FileUploader from './FileUploader';

interface UploadDialogProps {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  currentFolderId?: number;
  onUploadComplete?: () => void;
}

function UploadDialog({
  open,
  onOpenChange,
  currentFolderId,
  onUploadComplete
}: UploadDialogProps) {
  const handleUploadComplete = () => {
    onUploadComplete?.();
    onOpenChange(false);
  };

  return (
    <Dialog open={open} onOpenChange={onOpenChange}>
      <DialogContent className="max-w-5xl max-h-[85vh] overflow-hidden p-0 gap-0">
        <DialogHeader className="px-6 py-4 border-b">
          <DialogTitle className="text-xl font-semibold">文件上传</DialogTitle>
        </DialogHeader>
        <div className="overflow-y-auto p-6">
          <FileUploader 
            currentFolderId={currentFolderId}
            onUploadComplete={handleUploadComplete}
            onClose={() => onOpenChange(false)}
          />
        </div>
      </DialogContent>
    </Dialog>
  );
}

export default UploadDialog;